/* 学习目标：实现新增功能  */

import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { TodoAddAction } from './action/todo';

export default function App() {
  const { list } = useSelector((state) => state.todo);

  const dispatch = useDispatch();

  return (
    <div>
      {list.map((item) => (
        <h3 key={item.id}>{item.task}</h3>
      ))}

      <button onClick={() => dispatch(TodoAddAction('学习React'))}>
        点我新增-学习React
      </button>
    </div>
  );
}
